package org.jeecg.modules.system.controller;

import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.system.entity.SysAnnouncementSta;
import org.jeecg.modules.system.entity.SysUserCountSta;
import org.jeecg.modules.system.entity.SysVeteranSta;
import org.jeecg.modules.system.service.ISysAnnouncementService;
import org.jeecg.modules.system.service.ISysLogService;
import org.jeecg.modules.system.vo.SysNameValueVo;
import org.jeecg.modules.veterans.service.ISysServiceService;
import org.jeecg.modules.veterans.service.ISysVeteransService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 名称
 *
 * @author: 仝明明
 * @Date:Create in 11:25 PM 2023/9/12
 */

@Slf4j
@RestController
@RequestMapping("/sys/statistic")
public class StatisticController {

    @Autowired
    private ISysAnnouncementService sysAnnouncementService;
    @Autowired
    private ISysServiceService serviceService;
    @Autowired
    private ISysVeteransService veteransService;
    @Autowired
    private ISysLogService logService;

    @GetMapping("/policy")
    public Result<SysAnnouncementSta> policy()  {
        SysAnnouncementSta sta = sysAnnouncementService.policySta();
        return Result.ok(sta);
    }
    @GetMapping("/serviceType")
    public Result<List<SysNameValueVo>> serviceType()  {
        Result<List<SysNameValueVo>> result = new Result<>();
        List<SysNameValueVo> list = serviceService.serviceType();
        result.setSuccess(true);
        result.setResult(list);
        return result;
    }
    @GetMapping("/serviceArea")
    public Result<List<SysNameValueVo>> serviceArea()  {
        Result<List<SysNameValueVo>> result = new Result<>();
        List<SysNameValueVo> list = serviceService.serviceArea();
        result.setSuccess(true);
        result.setResult(list);
        return result;
    }
    @GetMapping("/userCount")
    public Result<SysUserCountSta> userCount()  {
        SysUserCountSta dto = serviceService.userCount();
        return Result.ok(dto);
    }

    @GetMapping("/veteranSta")
    public Result<SysVeteranSta> veteranSta()  {
        SysVeteranSta dto = veteransService.veteranSta();
        return Result.ok(dto);
    }
    @GetMapping("/veteranAgeSta")
    public Result<List<SysNameValueVo>> veteranAgeSta()  {
        Result<List<SysNameValueVo>> result = new Result<>();
        List<SysNameValueVo> list = veteransService.veteranAgeSta();
        result.setSuccess(true);
        result.setResult(list);
        return result;
    }
    @GetMapping("/daliyActive")
    public Result<List<SysNameValueVo>> daliyActive()  {
        Result<List<SysNameValueVo>> result = new Result<>();
        List<SysNameValueVo> list = logService.daliyActive();
        result.setSuccess(true);
        result.setResult(list);
        return result;
    }
}
